<?php
/* @authorcode  codestrings
 * @copyright   Leyun internet Technology(Shanghai)Co.,Ltd
 * @license     http://www.dzzoffice.com/licenses/license.txt
 * @package     DzzOffice
 * @link        http://www.dzzoffice.com
 * @author      zyx(zyx@dzz.cc)
 */
if(!defined('IN_DZZ')) {
	exit('Access Denied');
}
if(!$_G['uid']){
	showmessage(lang('to_login'));
	exit();
}
$navtitle=lang('评论管理').' - '.lang('record_book');
$uid1=$_G['uid'];
include_once libfile('function/common');
$perpage = 20;
  $keyword = isset($_GET['keyword']) ? trim($_GET['keyword']) : '';
  $page = (isset($_GET['page'])) ? intval($_GET['page']) : 1;
  $start = ($page - 1) * $perpage;
  $gets = array(
		'mod'=>MOD_NAME,
		'op'=>'liuyan',
		'do'=>'jilu',
    'keyword' => $keyword,
		'dateline' => $_GET['dateline'],
    'type' => $_GET['type']
  );
  $theurl = BASESCRIPT . "?" . url_implode($gets);
  $refer = $theurl . '&page=' . $page;
	if ($_GET['dateline'] == 'desc') {
    $order = 'ORDER BY dateline DESC';
	}else {
        $_GET['dateline'] = 'asc';
        $order = 'ORDER BY dateline ASC';
    }
  $sql = "cid!='app'";
  $foldername = array();
  $param = array();
  if ($keyword) {
    $sql .= 'and (message LIKE %s or author LIKE %s)';
    $param[] = '%' . $keyword . '%';
    $param[] = $keyword;
  }
  $limitsql = 'limit ' . $start . ',' . $perpage;
  if ($_G['adminid']) {
    if ($count = DB::result_first("SELECT COUNT(*) FROM " . DB::table('jilu_comment') . " WHERE cid!='app'", $param)) {
      $data = DB::fetch_all("SELECT * FROM " . DB::table('jilu_comment') . " WHERE cid!='app' $order $limitsql", $param);
    }
  }else{
    if ($count = DB::result_first("SELECT COUNT(*) FROM " . DB::table('jilu_comment') . " WHERE authorid =$uid1 and cid!='app'", $param)) {
      $data = DB::fetch_all("SELECT * FROM " . DB::table('jilu_comment') . " WHERE authorid =$uid1 and cid!='app' $order $limitsql", $param);
    }
  }
  $multi = multi($count, $perpage, $page, $theurl);
  $list = array();
  foreach ($data as $value) {
      $list[] = $value;
    }
include template('liuyan');

?>
